import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

class ButtonExps extends StatelessWidget {
  const ButtonExps({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Button Examples'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            IconButton(
              iconSize: 58,
              color: Colors.blue, // 图标颜色
              icon: const Icon(Icons.arrow_back), // 图标，比如心形、设置、分享等
              onPressed: () {
                if (kDebugMode) {
                  print('IconButton 被点击了！');
                }
              },
            ),
            // 可设置背景色
            ElevatedButton(
              style: ElevatedButton.styleFrom(
                shape: const CircleBorder(),
                backgroundColor: const Color(0xFFF2F3F7), // 按钮背景色
              ),
              onPressed: () {
                if (kDebugMode) {
                  print('圆形按钮被点击了');
                }
              },
              child: const Icon(
                Icons.arrow_back,
                color: Colors.black,
              ),
            ),
            TextButton(
              onPressed: () {
                if (kDebugMode) {
                  print('Text Button Pressed');
                }
              },
              child: const Text('Text Button'),
            ),
            OutlinedButton(
              onPressed: () {
                if (kDebugMode) {
                  print('Outlined Button Pressed');
                }
              },
              child: const Text('Outlined Button'),
            ),
            /// 固定大小
            SizedBox(
              width: 200,
              height: 50,
              child: ElevatedButton(
                onPressed: () {
                  if (kDebugMode) {
                    print('Elevated Button Pressed');
                  }
                },
                child: const Text('fixed size button'),
              ),
            ),
            ConstrainedBox(
              constraints: BoxConstraints.tightFor(width: 200.0, height: 50.0),
              child: ElevatedButton(
                onPressed: () {
                  if (kDebugMode) {
                    print('ConstrainedBox Button Pressed');
                  }
                },
                child: const Text('ConstrainedBox Button'),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
